/*
 * @Author: xurenda <xurenda@qq.com>
 * @HomePage: https://xurenda.top
 * @Github: https://github.com/xurenda
 * @Date: 2019-10-12 20:50:30
 * @LastEditTime: 2019-12-10 21:31:21
 * @FilePath: \elegant-surf\src\store\mutations.js
 */
import * as types from './mutationsTypes'

export default {

  // 初始化
  [types.INIT] (state) {
    state.init = 'init'
  },

  // 改变 通用-语言
  [types.COMMONSETTING_LANGUAGE] (state, data) {
    state.commonSetting.language = data
  },

  // 改变 搜索-默认引擎
  [types.SEARCHSETTING_DEFAULTENGINE] (state, data) {
    state.searchSetting.defaultEngine = data
  },

  // 改变 外观-主题
  [types.APPEARANCESETTING_THEME] (state, data) {
    state.appearanceSetting.theme = data
  },
  
  // 改变 外观-圆角效果
  [types.APPEARANCESETTING_ROUNDED] (state, data) {
    state.appearanceSetting.rounded = data
  },

  // 改变 背景-颜色
  [types.BACKGROUND_COLOR] (state, data) {
    state.background.isColor = true
    state.background.color = data
  },

  // 添加 背景-颜色
  [types.ADD_BACKGROUND_COLOR] (state, data) {
    state.background.colors.push(data)
  },
  
  // 改变 背景-效果
  [types.BACKGROUND_SKETCH] (state, data) {
    state.background.isColor = false
    state.background.sketch = data
  },

  // // 改变 首页日常书签
  [types.DAILY_MARKS] (state, data) {
    const { index, name, url, icon } = data
    state.dailyMarks[index].name = name
    state.dailyMarks[index].url = url
    state.dailyMarks[index].icon = icon
  }
}
